Set docker daemon as service in CentOS7   2019-10-31


Note: You must run as root

1
2
3
4
5
6
7
8
9
10
cd /etc/systemd/system
wget https://raw.githubusercontent.com/moby/moby/master/contrib/init/systemd/docker.service
wget https://raw.githubusercontent.com/moby/moby/master/contrib/init/systemd/docker.socket

# check status
sudo systemctl status docker
# auto start when boots
sudo systemctl enable docker
# manually start
sudo systemctl start docker

https://docs.docker.com/config/daemon/systemd/#manually-create-the-systemd-unit-files